package cn.fql.system.service.impl;

import cn.fql.basic.service.impl.BaseServiceImpl;
import cn.fql.system.domain.Detail;
import cn.fql.system.domain.Type;
import cn.fql.system.mapper.DetailMapper;
import cn.fql.system.mapper.TypeMapper;
import cn.fql.system.service.ITypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl extends BaseServiceImpl<Type> implements ITypeService {

    @Autowired
    private TypeMapper typeMapper;
    @Autowired
    private DetailMapper detailMapper;
    @Override
    public void del(Long id) {
        List<Detail> all = detailMapper.findAll();
        for (Detail detail : all) {
            if(detail.getTypes_id()==id){
                detailMapper.del(detail.getId());
            }
        }
        typeMapper.del(id);
    }


}
